/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.amu.wmi.kino.visualjavafx.model.api;

import pl.edu.amu.wmi.kino.visualjavafx.model.objects.Application;

/**
 * This Interaface has two uses
 * 1. you can use it if you make an javaFx file - or anything that represent's it
 * 2. it is exported as a service so you can add model generators for test's,
 * for that you get them with : Lookup.getDefault().lookup(VisualJavaFxModelProvider.class);
 * or with other methots that lookup has.
 * @author psychollek
 */
public interface VisualJavaFxModelProvider extends ModelChangeListener, ModelChangeNotifier{

    public Application getModel();

    @Override
    public void addModelChangeListener(ModelChangeListener listener);

    @Override
    public void removeModelChangeListener(ModelChangeListener listener);
    /**
     * implementation shall pass evt to listeners or verify evt and do nothing
     * if verification failed.
     *
     * sample implementation:

            Object[] who = evt.getWho();

            for (int i = 0; i < who.length; i++) {
                if (who[i] == this) return;
            }

            for (Iterator<ModelChangeListener> it = listeners.iterator(); it.hasNext();) {
                ModelChangeListener modelChangeListener = it.next();
                modelChangeListener.notifyModelChange(ModelChangeEvent.passEvent(evt, this));
            }
     *
     * @param evt - event to be passed.
     */
    @Override
    public void notifyModelChange(ModelChangeEvent evt);


}
